Fix attribute type resolution with multiple inheritance#18415
Merged
ilevkivskyi merged 5 commits intopython:masterfrom Jan 11, 2025
Merged
Fix attribute type resolution with multiple inheritance#18415ilevkivskyi merged 5 commits intopython:masterfrom
ilevkivskyi merged 5 commits intopython:masterfrom
Conversation
…llowing bases needn't be compatible
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Collaborator
hauntsaninja
left a comment
There was a problem hiding this comment.
Nice, will leave for Ivan but had small comment
| pass | ||
|
|
||
| class D(D0,D1,C): | ||
| pass |
Collaborator
There was a problem hiding this comment.
Should we expect an error for something like:
class D3(D0,D1,C):
class M(A.M):
pass
Collaborator
Author
There was a problem hiding this comment.
We certainly should expect an error there as such an override violates LSP. But overrides are checked elsewhere, I'm only modifying inherited attributes compatibility checks in this PR.
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
Contributor
|
Diff from mypy_primer, showing the effect of this PR on open source code: xarray (https://github.com/pydata/xarray)
+ xarray/core/groupby.py:1610: error: Unused "type: ignore" comment [unused-ignore]
+ xarray/core/groupby.py:1778: error: Unused "type: ignore" comment [unused-ignore]
+ xarray/core/resample.py:236: error: Unused "type: ignore" comment [unused-ignore]
+ xarray/core/resample.py:379: error: Unused "type: ignore" comment [unused-ignore]
ibis (https://github.com/ibis-project/ibis)
- ibis/common/collections.py:280: error: Definition of "get" in base class "Mapping" is incompatible with definition in base class "Mapping" [misc]
|
ilevkivskyi
approved these changes
Jan 11, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #18268. Fixes #9319. Fixes #14279. Fixes #9031.
Supersedes #18270 as requested by @ilevkivskyi.
This PR introduces two changes:
map_type_from_supertypewhen checking generic attributes